HomeCard.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. "use client";
  2. import { BannerRep } from "@/api/home";
  3. import Box from "@/components/Box";
  4. import { FC, PropsWithChildren } from "react";
  5. import { Swiper, SwiperSlide } from "swiper/react";
  6. // const Box = dynamic(() => import("@/components/Box"));
  7. interface Props {
  8. banners: BannerRep[];
  9. }
  10. const HomeCard: FC<PropsWithChildren<Props>> = (props) => {
  11. const { banners = [] } = props;
  12. return (
  13. <Swiper slidesPerView={2} spaceBetween={10}>
  14. {banners?.map((banner, index) => (
  15. <SwiperSlide key={index} className={"my-[0.08rem]"}>
  16. <Box
  17. className={""}
  18. none
  19. action={banner.action_type}
  20. actionData={banner.action_params}
  21. >
  22. <img
  23. src={banner.content!}
  24. alt=""
  25. className={"w-[100%] rounded-[0.06rem]"}
  26. />
  27. </Box>
  28. </SwiperSlide>
  29. ))}
  30. </Swiper>
  31. );
  32. };
  33. export default HomeCard;